<?php
include("../conn/conn.php");
header("content-type:text/html;charset=utf-8");
$sql="select * from tb_manager where name='".$_POST['username']."'";
$result=mysqli_query($link,$sql);
if(mysqli_num_rows($result)>0){
	echo ("<script>alert('已经有此管理员账号');history.go(-1);</script>");
	exit();
	}
	else{
	$sql_add="insert into tb_manager values('','".$_POST['username']."','".$_POST['password']."','".$_POST['type']."','".$_POST['realname']."','".date("Y-m-d")."','1')";//定义插入语句
	mysqli_query($link,$sql_add);
	?>
	<script>
			alert("管理员添加成功");
			top.opener.location.reload(); 
			top.window.close();
		</script>
	<?php
    	}
		?>

